#coding:utf-8
import web
import public
import database

class test():
    def GET(self):
        session.login+=1
        return str(database.database().check_user('user1','1234'))

web.config.debug=False  #debug 模式会导致session失效

urls = (
        '/', 'index.main',
        '/new_servicer','new_servicer.main',
        '/delete_servicer','delete_servicer.main',
        '/edit_servicer','edit_servicer.main',
        '/new_baseinfo','new_baseinfo.main',
        '/login','login.main',
        '/test','test'
        )

#app = web.application(urls, globals(),autoreload=True) #autoreload 会导致session失效
app = web.application(urls, globals())

#session
session = web.session.Session(app, web.session.DiskStore('sessions'), initializer={'login': 0})
web.config.session_parameters['timeout'] = 24*60*60 # 24 hours   in seconds
session.login=0
#web.config._session=session
public.session=session

if __name__ == "__main__":
    app.run()